﻿@using Microsoft.AspNetCore.Mvc.Localization
@using Skoruba.IdentityServer4.Admin.UI.Configuration.Constants
@model Skoruba.IdentityServer4.Admin.BusinessLogic.Dtos.Configuration.ClientDto
@inject IViewLocalizer Localizer

<div class="card mt-3">
	<h5 class="card-header">@Localizer["PanelTitle"]</h5>
	<div class="card-body">
		<!--Input - number -->
        <div class="form-group row">
            <label asp-for="IdentityTokenLifetime" class="col-sm-3 col-form-label">
                @await Html.PartialAsync("Client/Section/Label", "IdentityTokenLifetime")
            </label>
            <div class="col-sm-9">
                <input type="number" class="form-control" asp-for="IdentityTokenLifetime">
            </div>
        </div>
		
        <!--Select with tags-->
        <div class="form-group row">
            <label asp-for="AllowedIdentityTokenSigningAlgorithms" class="col-sm-3 col-form-label">
                @await Html.PartialAsync("Client/Section/Label", "SigningAlgorithms")
            </label>
            <div class="col-sm-9">
                <picker id="AllowedIdentityTokenSigningAlgorithmsItems" multiple-select="true" min-search-text="2"
                        selected-items="@Model.AllowedIdentityTokenSigningAlgorithms" url="@Url.Action("SearchSigningAlgorithms","Configuration")?algorithm"
                        search-input-placeholder="@Localizer["PickerSearchItemPlaceholder"].Value"
                        selected-items-title="@Localizer["PickerSelectedItemsTitle"].Value"
                        search-result-title="@Localizer["PickerSearchResultTitle"].Value"
                        suggested-items-title="@Localizer["PickerSuggestedItemsTitle"].Value"
                        no-item-selected-title="@Localizer["PickerNoItemSelectedTitle"].Value"
                        show-all-items-title="@Localizer["PickerShowAllItemsTitle"].Value"
                        item-already-selected-title="@Localizer["PickerItemAlreadySelectedTitle"].Value">
                </picker>
            </div>
        </div>

        <!--Input - number -->
		<div class="form-group row">
			<label asp-for="AccessTokenLifetime" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AccessTokenLifetime")
			</label>
			<div class="col-sm-9">
				<input type="number" class="form-control" asp-for="AccessTokenLifetime">
			</div>
		</div>

		<!--Select-->
		<div class="form-group row">
			<label asp-for="AccessTokenTypes" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AccessTokenTypes")
			</label>
			<div class="col-sm-9">
				<select asp-for="AccessTokenType" asp-items="@(new SelectList(Model.AccessTokenTypes,"Id","Text"))" class="form-control single-select"></select>
			</div>
		</div>

		<!--Input - number -->
		<div class="form-group row">
			<label asp-for="AuthorizationCodeLifetime" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AuthorizationCodeLifetime")
			</label>
			<div class="col-sm-9">
				<input type="number" class="form-control" asp-for="AuthorizationCodeLifetime">
			</div>
		</div>

		<!--Input - number-->
		<div class="form-group row">
			<label asp-for="AbsoluteRefreshTokenLifetime" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AbsoluteRefreshTokenLifetime")
			</label>
			<div class="col-sm-9">
				<input type="number" class="form-control" asp-for="AbsoluteRefreshTokenLifetime">
			</div>
		</div>

		<!--Input - number -->
		<div class="form-group row">
			<label asp-for="SlidingRefreshTokenLifetime" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "SlidingRefreshTokenLifetime")
			</label>
			<div class="col-sm-9">
				<input type="number" class="form-control" asp-for="SlidingRefreshTokenLifetime">
			</div>
		</div>

		<!--Select-->
		<div class="form-group row">
			<label asp-for="RefreshTokenUsage" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "RefreshTokenUsage")
			</label>
			<div class="col-sm-9">
				<select asp-for="RefreshTokenUsage" asp-items="@(new SelectList(Model.RefreshTokenUsages,"Id","Text"))" class="form-control single-select"></select>
			</div>
		</div>

		<!--Select-->
		<div class="form-group row">
			<label asp-for="RefreshTokenExpiration" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "RefreshTokenExpiration")
			</label>
			<div class="col-sm-9">
				<select asp-for="RefreshTokenExpiration" asp-items="@(new SelectList(Model.RefreshTokenExpirations,"Id","Text"))" class="form-control single-select"></select>
			</div>
		</div>

		<!--Select with tags-->
		<div class="form-group row">
			<label asp-for="AllowedCorsOrigins" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AllowedCorsOrigins")
			</label>
			<div class="col-sm-9">
				<picker id="AllowedCorsOriginsItems" multiple-select="true" min-search-text="2"
				        selected-items="@Model.AllowedCorsOrigins"
				        search-input-placeholder="@Localizer["PickerSearchItemPlaceholder"].Value"
				        selected-items-title="@Localizer["PickerSelectedItemsTitle"].Value" 
				        search-result-title="@Localizer["PickerSearchResultTitle"].Value"
				        suggested-items-title="@Localizer["PickerSuggestedItemsTitle"].Value" 
				        no-item-selected-title="@Localizer["PickerNoItemSelectedTitle"].Value" 
				        show-all-items-title="@Localizer["PickerShowAllItemsTitle"].Value"
				        item-already-selected-title="@Localizer["PickerItemAlreadySelectedTitle"].Value">
				</picker>
			</div>
		</div>

		<!--Checkbox-->
		<div class="form-group row">
			<label asp-for="UpdateAccessTokenClaimsOnRefresh" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "UpdateAccessTokenClaimsOnRefresh")
			</label>
			<div class="col-sm-9">
				<toggle-button>
					<input asp-for="UpdateAccessTokenClaimsOnRefresh" type="checkbox">
				</toggle-button>
			</div>
		</div>

		<!--Checkbox-->
		<div class="form-group row">
			<label asp-for="IncludeJwtId" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "IncludeJwtId")
			</label>
			<div class="col-sm-9">
				<toggle-button>
					<input asp-for="IncludeJwtId" type="checkbox">
				</toggle-button>
			</div>
		</div>

		<!--Checkbox-->
		<div class="form-group row">
			<label asp-for="AlwaysSendClientClaims" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AlwaysSendClientClaims")
			</label>
			<div class="col-sm-9">
				<toggle-button>
					<input asp-for="AlwaysSendClientClaims" type="checkbox">
				</toggle-button>
			</div>
		</div>

		<!--Checkbox-->
		<div class="form-group row">
			<label asp-for="AlwaysIncludeUserClaimsInIdToken" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "AlwaysIncludeUserClaimsInIdToken")
			</label>
			<div class="col-sm-9">
				<toggle-button>
					<input asp-for="AlwaysIncludeUserClaimsInIdToken" type="checkbox">
				</toggle-button>
			</div>
		</div>

		<!--Input - text -->
		<div class="form-group row">
			<label asp-for="ClientClaimsPrefix" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "ClientClaimsPrefix")
			</label>
			<div class="col-sm-9">
				<input type="text" class="form-control" asp-for="ClientClaimsPrefix">
			</div>
		</div>

		<!--Input - text -->
		<div class="form-group row">
			<label asp-for="PairWiseSubjectSalt" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "PairWiseSubjectSalt")
			</label>
			<div class="col-sm-9">
				<input type="text" class="form-control" asp-for="PairWiseSubjectSalt">
			</div>
		</div>

		<!--Button-->
		<div class="form-group row">
			<label asp-for="Claims" class="col-sm-3 col-form-label">
				@await Html.PartialAsync("Client/Section/Label", "Claims")
			</label>
			<div class="col-sm-9">
				<a asp-area="@CommonConsts.AdminUIArea" asp-action="ClientClaims" asp-route-id="@Model.Id" target="_blank" class="btn btn-primary">@Localizer["ButtonManageClientClaims"]</a>
			</div>
		</div>
	</div>
</div>